//
//  ThirdTableViewCell.m
//  MarianasTrench
//
//  Created by wangjue on 16/3/18.
//  Copyright © 2016年 王爵. All rights reserved.
//

#import "ThirdTableViewCell.h"

@interface ThirdTableViewCell ()
@property (nonatomic, retain) UIImageView *leftImage;
@property (nonatomic, retain) UILabel *rightTopLabel;
@property (nonatomic, retain) UILabel *rightDownLabel;
@property (nonatomic, retain) UIView *lineView;
@property (nonatomic, retain) UIView *upLineView;


@end

@implementation ThirdTableViewCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        [self createSubViews];
        
    }
    return self;
}

-(void)createSubViews{
    self.upLineView = [[UIView alloc] init];
    [self.contentView addSubview:_upLineView];
    
    self.leftImage = [[UIImageView alloc] init];
    [self.contentView addSubview:_leftImage];
    
    self.rightTopLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_rightTopLabel];
    
    self.rightDownLabel = [[UILabel alloc] init];
    [self.contentView addSubview:_rightDownLabel];
    
    self.lineView = [[UIView alloc] init];
    [self.contentView addSubview:_lineView];
}


-(void)layoutSubviews{
    [super layoutSubviews];
    
    _upLineView.frame = CGRectMake(0, 0, self.contentView.frame.size.width, 1);
    _upLineView.backgroundColor = [UIColor grayColor];
    
    _leftImage.frame = CGRectMake(10, 10, self.contentView.frame.size.width / 4, 100);
    
    _rightTopLabel.frame = CGRectMake(_leftImage.frame.origin.x + self.contentView.frame.size.width / 4 + 10, 10, self.contentView.frame.size.width / 2, 20);
    
    _rightDownLabel.frame = CGRectMake(_rightTopLabel.frame.origin.x, 40, self.contentView.frame.size.width / 1.5, 40);
    _rightDownLabel.numberOfLines = 2;
    _rightDownLabel.font = [UIFont systemFontOfSize:15];
    _rightDownLabel.textColor = [UIColor grayColor];
    
    _lineView.frame = CGRectMake(0, self.contentView.frame.origin.y, self.contentView.frame.size.width, 1);
    _lineView.backgroundColor = [UIColor blackColor];
    
   
    
   }

-(void)setHistory:(History *)history{
    _history = history;
    
    [_leftImage sd_setImageWithURL:[NSURL URLWithString:_history.imgStr] placeholderImage:[UIImage imageNamed:@"no_network@3x"]];
    
    _rightTopLabel.text = _history.textLabel;
    
    _rightDownLabel.text = _history.textDownLabel;
    

}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
